package bdqn.servlet;

import bdqn.dao.MeetingRoomDao;
import bdqn.dao.impl.MeetingRoomDaoImpl;
import bdqn.entity.MeetingRoom;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "MeetingRoomServlet",urlPatterns = "/MeetingRoomServlet")
public class MeetingRoomServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        request.setCharacterEncoding("utf-8");
        MeetingRoomDao meetingRoomDao=new MeetingRoomDaoImpl();
        List<MeetingRoom> meetingRoomList=meetingRoomDao.meetList();
        request.setAttribute("meetingRoomList",meetingRoomList);
        request.getRequestDispatcher("index.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.doPost(request,response);
    }
}
